var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/print/index.ts
var print_exports = {};
__export(print_exports, {
  $Print: () => $Print
});
module.exports = __toCommonJS(print_exports);
var import_util = require("../../util");
var import_PrintModal = require("./PrintModal");
var import_service = require("./service");
var import_util2 = require("./util");
var MAX_PRINT_COUNT = 2147483647;
async function _printWithPdKey(params) {
  const { batchPrintList, bizCode } = params;
  if (batchPrintList.length === 0) {
    await (0, import_util2.wfAlert)(import_util2.info.alertTitle, import_util2.info.selectOneData);
  } else {
    const res = await (0, import_service.getPrintTemplate)({
      pageSize: MAX_PRINT_COUNT,
      pageIndex: 1,
      bizCode,
      isFilterProject: true,
      isEnable: true
    });
    const templateData = (res == null ? void 0 : res.list) || [];
    await (0, import_PrintModal.openPrintModal)({
      ...params,
      data: templateData
    });
  }
}
async function _print(batchPrintList, bizCode, source_sys, callback, cancelback) {
  await _printWithPdKey({ batchPrintList, bizCode, source_sys, cancelback, callback });
}
var $Print = {
  // 打印
  print(params) {
    return new Promise((resolve, reject) => {
      const batchPrintList = (params == null ? void 0 : params.batchPrintList) || (params == null ? void 0 : params.bacthPrintList) || (params == null ? void 0 : params.id);
      _print(
        batchPrintList,
        params.bizCode,
        params.source_sys,
        (...args) => {
          var _a;
          (_a = params.successCallback) == null ? void 0 : _a.call(params, ...args);
          resolve(args);
        },
        (...args) => {
          var _a;
          (_a = params.cancelCallback) == null ? void 0 : _a.call(params, ...args);
          reject(args);
        }
      ).then();
    });
  }
};
import_util.iup.registerExternal({
  getPrintSdk() {
    return $Print;
  }
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  $Print
});
